<?php
namespace PsiFramework\Classes\Model;

import("Classes.Util.Object.ReferenceObject");

use \PsiFramework\Classes\Util\Object\ReferenceObject;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe abstraite d'Objet
 *
 * @package Model
 */
abstract class Object
{

    protected /*string*/ $_objectName ;

    public abstract function getId();
    public abstract function toString();

    public function getObjectName()
    {
        return $this->_objectName ;
    }

    public function setObjectName(/*string*/ $objectName)
    {
        $this->_objectName = $objectName;
    }

    public function getReferenceObject()
    {
        return new ReferenceObject($this->_objectName, $this->getId());
    }

    public function __call($method, $args)
    {
        throw new \Exception(
            "The method '".$method."' doesn't exist ".
            "for class '".get_class($this)."'"
        );
    }

    public function __toString()
    {
        return (string) $this->toString();
    }
}
